﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using PipeUtil.Pipe;

namespace PipeUtil
{
    public class Sample
    {
        public static void Main(String[] args)
        {
            //Start Server
            var server = new PipeServer("PipeServer", new BusinessDelegateImpl());
            server.Start();



            //Request
            var client = new PipeClient(".", "PipeServer");
            var response = client.Send("what time is it");
            Debug.Print(string.Format("Current time is: {0}",response));
        }
    }


    public class BusinessDelegateImpl : IBusinessDelegate
    {
        public string SendRequest(string message)
        {
            switch (message.ToUpper())
            {
                case "WHAT TIME IS IT":
                    return DateTime.Now.ToString();
                    break;
                default:
                    return "Command not found!!!";
                    break;
            }
        }
    }
}
